//
//  WBStatusListViewModel.swift
//  Swift微博练习
//
//  Created by 练锦波 on 2017/3/16.
//  Copyright © 2017年 练锦波. All rights reserved.
//

import Foundation

class WBStatusListViewModel {
    lazy var statuslist = [WBStatus]()
    
    func loadStatus(completion: @escaping (_ isSuccess: Bool)->()) {
        WBNetworkManager.shared.statuList { (list, isSuccess) in
            // 1.字典转模型
            guard let array = NSArray.yy_modelArray(with: WBStatus.self, json: list ?? []) as? [WBStatus] else {
                completion(isSuccess)
                return
            }
            
            // 2.拼接数据
            self.statuslist += array
            
            // 3.完成回调
            completion(isSuccess)
        }
    }
}

